lsp initialization#9
Merged
Merged
Conversation
Owner
sigfriedCub1990
commented
Mar 3, 2026
- refactor: extract common buffer load/cleanup logic into utils.with_buf
- fix: suppress file path echo when jumping to fixture definition
- fix: suppress file info message when jumping to a file
- fix: use vim.fn.execute() to suppress file info on jump
- fix: suppress file info message printed by bufload during scanning
Suppress autocommands during temporary buffer loads to prevent LSP clients from attaching to every scanned file. Extract the repeated pattern (bufadd, bufload, filetype set, cleanup) from ts.lua, usages.lua, and rename.lua into a shared utils.with_buf() helper.
':edit' prints the file info message (path, line count, bytes) on every jump. Use ':silent edit' to suppress it.
':silent edit' only suppresses Vimscript-level messages. Neovim's file
info message ("file.py" 42L, 1234B) is printed by Neovim's internals
and is controlled by the 'F' flag in 'shortmess'. Temporarily append it
around ':edit' and restore the original value afterward.
Both ':silent edit' and temporarily setting shortmess+=F failed because Neovim's C-level fileinfo message can be displayed after the Lua frame completes, by which point shortmess has been restored and :silent no longer applies. vim.fn.execute() is backed by :redir, which captures all output at the channel level before it reaches the command line. This gives reliable suppression regardless of message timing. Also adds fnameescape() for correct handling of paths with special characters.
eventignore = 'all' only suppresses autocommands. It does not suppress
the C-level file-reading message ('path/to/file' NL, NB) that
bufload() emits via open_buffer() → readfile(). Wrap the bufload call
in vim.fn.execute() which uses :redir internally to capture all output
at the channel level before it reaches the command line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.